home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xfig.idb / usr / freeware / src / xfig / transfig.3.1.2 / fig2dev / arrow.c.z / arrow.c
Encoding:
C/C++ Source or Header  |  1997-09-09  |  2.8 KB  |  98 lines

  1. /*
  2.  * TransFig: Facility for Translating Fig code
  3.  * Copyright (c) 1985 Supoj Sutantavibul
  4.  * Copyright (c) 1991 Micah Beck
  5.  *
  6.  * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  7.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  8.  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  9.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  10.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  11.  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  12.  * PERFORMANCE OF THIS SOFTWARE.
  13.  *
  14.  * The X Consortium, and any party obtaining a copy of these files from
  15.  * the X Consortium, directly or indirectly, is granted, free of charge, a
  16.  * full and unrestricted irrevocable, world-wide, paid up, royalty-free,
  17.  * nonexclusive right and license to deal in this software and
  18.  * documentation files (the "Software"), including without limitation the
  19.  * rights to use, copy, modify, merge, publish, distribute, sublicense,
  20.  * and/or sell copies of the Software, and to permit persons who receive
  21.  * copies from any such party to do so, with the only requirement being
  22.  * that this copyright notice remain intact.  This license includes without
  23.  * limitation a license to do the foregoing actions under any patents of
  24.  * the party supplying this software to the X Consortium.
  25.  */
  26.  
  27. #include <stdio.h>
  28. #include "alloc.h"
  29. #include "fig2dev.h"
  30. #include "object.h"
  31.  
  32. extern float        THICK_SCALE;
  33.  
  34. static double        forward_arrow_wid = 4;
  35. static double        forward_arrow_ht = 8;
  36. static int        forward_arrow_type = 0;
  37. static int        forward_arrow_style = 0;
  38. static double        forward_arrow_thickness = 1;
  39.  
  40. static double        backward_arrow_wid = 4;
  41. static double        backward_arrow_ht = 8;
  42. static int        backward_arrow_type = 0;
  43. static int        backward_arrow_style = 0;
  44. static double        backward_arrow_thickness = 1;
  45.  
  46. F_arrow *
  47. forward_arrow()
  48. {
  49.     F_arrow        *a;
  50.  
  51.     if (NULL == (Arrow_malloc(a))) {
  52.         put_msg(Err_mem);
  53.         return(NULL);
  54.         }
  55.     a->type = forward_arrow_type;
  56.     a->style = forward_arrow_style;
  57.     a->thickness = forward_arrow_thickness*THICK_SCALE;
  58.     a->wid = forward_arrow_wid;
  59.     a->ht = forward_arrow_ht;
  60.     return(a);
  61.     }
  62.  
  63. F_arrow *
  64. backward_arrow()
  65. {
  66.     F_arrow        *a;
  67.  
  68.     if (NULL == (Arrow_malloc(a))) {
  69.         put_msg(Err_mem);
  70.         return(NULL);
  71.         }
  72.     a->type = backward_arrow_type;
  73.     a->style = backward_arrow_style;
  74.     a->thickness = backward_arrow_thickness*THICK_SCALE;
  75.     a->wid = backward_arrow_wid;
  76.     a->ht = backward_arrow_ht;
  77.     return(a);
  78.     }
  79.  
  80. F_arrow *
  81. make_arrow(type, style, thickness, wid, ht)
  82. int    type, style;
  83. double    thickness, wid, ht;
  84. {
  85.     F_arrow        *a;
  86.  
  87.     if (NULL == (Arrow_malloc(a))) {
  88.         put_msg(Err_mem);
  89.         return(NULL);
  90.         }
  91.     a->type = type;
  92.     a->style = style;
  93.     a->thickness = thickness*THICK_SCALE;
  94.     a->wid = wid;
  95.     a->ht = ht;
  96.     return(a);
  97.     }
  98.